﻿namespace Yz.Base
{
    /// <summary>
    /// 数据列数据字典
    /// </summary>
    public class DbColDictionary : BaseModel
    {
        /// <summary>
        /// 字段名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 字段备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 数据类型
        /// </summary>
        public Type Type { get; set; }
        /// <summary>
        /// 字段长度（type是string 时赋值）
        /// </summary>
        public int MaxLength { get; set; } = 0;
        /// <summary>
        /// 是否可为空
        /// </summary>
        public bool Null { get; set; }
        /// <summary>
        /// 是否有主外键
        /// </summary>
        public string Key { get; set; }
        /// <summary>
        /// 排序（导入导出时赋值true）
        /// </summary>
        public int Order { get; set; }
        /// <summary>
        /// 批注（Excel导出时用到，读取display的值）
        /// </summary>
        public string Comment { get; set; }
    }
    /// <summary>
    /// 数据表数据字典
    /// </summary>
    public class DbTabDictionary : BaseModel
    {
        /// <summary>
        /// 表名
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 数据列
        /// </summary>

        public List<DbColDictionary> Cols { get; set; }
    }
    /// <summary>
    /// 数据库数据字典
    /// </summary>
    public class DbDictionary : BaseModel
    {
        /// <summary>
        /// 数据库名称
        /// </summary>
        public string DbName { get; set; }
        /// <summary>
        /// 数据表
        /// </summary>
        public List<DbTabDictionary> Tabs { get; set; }
    }
}
